import { createApp } from "vue";
// import * as Vue from "vue";
import App from "./App.vue";
import * as Sentry from "@sentry/vue";
import { Integrations } from "@sentry/tracing";

// cool
import { bootstrap } from "./core";

// router
import router from "./router";

// store
import store from "./store";

import "./mock";

// element-plus
import ElementPlus from "element-plus";
import "./assets/css/element-variables.scss";
import locale from "element-plus/lib/locale/lang/zh-cn";

// mitt
import mitt from "mitt";

// echarts
import VueECharts from "vue-echarts";
// Sentry
/*if (import.meta.env.VITE_APP_SENTRY_DNS) {
	Sentry.init({
		dsn: import.meta.env.VITE_APP_SENTRY_DNS,
		integrations: [new Integrations.BrowserTracing()],

		// Set tracesSampleRate to 1.0 to capture 100%
		// of transactions for performance monitoring.
		// We recommend adjusting this value in production
		tracesSampleRate: 1.0,
		release: import.meta.env.VITE_APP_VERSION
	});
}*/

const app = createApp(App);

bootstrap(app)
	.then(() => {
		// echarts 可视图表
		app.component("v-chart", VueECharts);

		// 事件通讯
		app.provide("mitt", mitt());

		app.use(store)
			.use(router)
			.use(ElementPlus, {
				locale,
				size: "mini" // 设置组件默认大小
			})
			.mount("#app");
	})
	.catch((err: string) => {
		console.error(`GDSHOP-ADMIN 启动失败`, err);
	});

store.dispatch("appLoad");

// @ts-ignore
window.__app__ = app;
